package mk.com.ldm.corepoint.implementation.client.lib.custom.cpstable;

import java.util.ArrayList;

import com.google.gwt.event.shared.GwtEvent;

public class ActionEvent extends GwtEvent<ActionEventHandler>{
	public static Type<ActionEventHandler> TYPE = new Type<ActionEventHandler>();
	public static final int EDIT = 0, DELETE = 1, DELETE_ALL = 2, SELECT = 3;
	private int action;
	private String id = "";
	private String value = "";
	private ArrayList<String> ids = new ArrayList<String>();
	private ListRow row = new ListRow();
	private String dataBaseTableName = "";
	
	public ActionEvent(){}

	public ActionEvent(String id, int action){
		this.id = id;
		this.action = action;
	}

	public ActionEvent(ArrayList<String> ids, int action){
		this.ids = ids;
		this.action = action;
	}
	
	public ActionEvent(ListRow row, int action){
		this.row = row;
		this.action = action;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public ArrayList<String> getIds() {
		return ids;
	}
	
	public int getAction() {
		return action;
	}
	
	public void setRow(ListRow row){
		this.row = row;
	}
	
	public ListRow getRow(){
		return row;
	}

	public String getDataBaseTableName() {
		return dataBaseTableName;
	}

	public void setDataBaseTableName(String dataBaseTableName) {
		this.dataBaseTableName = dataBaseTableName;
	}

	@Override
	public Type<ActionEventHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(ActionEventHandler handler) {
		handler.onEdit(this);
	}

}

